Home:ALL Converter>Get rid of "type qualifier" warnings on functions using the restrict keyword

Get rid of "type qualifier" warnings on functions using the restrict keyword

Ask Time:2014-05-31T02:35:02         Author:Dave

Json Formatter

I'm trying to clean up warnings that I'm getting when compiling Blitz++ of the form:

/opt/local/include/blitz/tinyvec2.h:261:35: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
/opt/local/include/blitz/tinyvec2.h:264:43: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 
/opt/local/include/blitz/tinyvec2.h:267:40: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
<<etc.>>

From these kinds of member functions (of the TinyVector class)

T_numtype * restrict data()    // line 261                      
    { return data_; }          // data is a member that is an array of data values

const T_numtype * restrict data() const       // line 264       
    { return data_; }       

As far as I can tell I am getting the warnings due to the restrict keyword. Note: there are macros that should replace the restrict with __restrict__ (which g++ understands).

I can get rid of the warnings by deleting the keywords; however, since this is supposed to be a high-performance numerical library, I don't want to lose any compiler optimizations that the restrict keywords are allowing.

What can I do to suppress these warnings without just dropping the restrict's altogether, and while keeping -Wall on?

Author:Dave,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/23961279/get-rid-of-type-qualifier-warnings-on-functions-using-the-restrict-keyword
yy